package com.bytedance.common.utility;

import android.util.Log;

public final class Logger {
    private static int sLevel = 0;

    public static void throwExceptionInDebug(Throwable throwable) {
        throwable.printStackTrace();
        if (Logger.debug()) {
            throw new RuntimeException("Error! Now in debug, we alert to you to correct it !", throwable);
        }
    }

    public static void v(String tag, String message) {
        if (message != null && Logger.sLevel <= 2) {
            Log.v(tag, message);
        }
    }

    public static void enableDebug() {
        Logger.sLevel = 0;
    }

    public static void d(String arg1) {
        Logger.d("Logger", arg1);
    }

    public static void d(String tag, String msg, Throwable throwable) {
        if (Logger.sLevel <= 3) {
            Log.d(tag, msg, throwable);
        }
    }

    public static boolean debug() {
        return Logger.sLevel <= 3;
    }

    public static void d(String tag, String msg) {
        if (msg != null && Logger.sLevel <= 3) {
            Log.d(tag, msg);
        }
    }

    public static void w(String tag, String message, Throwable throwable) {
        if (Logger.sLevel <= 5) {
            Log.w(tag, message, throwable);
        }
    }

    public static void i(String arg1) {
        Logger.i("Logger", arg1);
    }

    public static void e(String tag, String msg, Throwable tr) {
        if (Logger.sLevel <= 6) {
            Log.e(tag, msg, tr);
        }
    }

    public static void i(String tag, String message) {
        if (message != null && Logger.sLevel <= 4) {
            Log.i(tag, message);
        }
    }

    public static void w(String message) {
        Logger.w("Logger", message);
    }

    public static void w(String tag, String message) {
        if (message != null && Logger.sLevel <= 5) {
            Log.w(tag, message);
        }
    }

    public static void ee(String arg1) {
        Logger.e("Logger", arg1);
    }

    public static void e(String tag, String message) {
        if (message != null && Logger.sLevel <= 6) {
            Log.e(tag, message);
        }
    }

    public static void throwException(String message) {
        if (Logger.debug()) {
            throw new IllegalStateException(message);
        }
    }
}

